<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
	/*根选择器*/
	html:root{background:green;}
</style>
</head>
<body>
<p id="count">测试</p>
<script>
function local_cache ()
{
    var storage = window.localStorage;
    if(storage){
        //alert('yes');
        var num = parseInt(storage.getItem('num'));
        if(!num){
            num = 1;
        }else if(num >= 10){
            storage.removeItem('num');
        }else{
            num += 1;
        }
        storage.setItem('num',num);
        document.getElementById('count').innerHTML = num;
    }else{
        alert('no');
    }
}
local_cache();
</script>
</body>
</html>